package server.authentification.module.crypto;

import com.twmacinta.util.MD2;
import com.twmacinta.util.MD5;
/*
 * UserPasswordCheck.java
 *
 * Created on 5 Ноябрь 2006 г., 2:55
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */
public class UserPasswordCheck {
    public static String putIntoDateBase(String login, String password){
            MD2 hash1 = new MD2();
            return MD5.asHex(hash1.run(password+login));
    }
    public static boolean auth(String hash, String login, String seed,String compareWith){
            MD5 hash2 = new MD5(compareWith+seed);
            hash2.initNativeLibrary(true);
            return (hash.equals(MD5.asHex(hash2.Final())));
    }
}

